# """
# 二叉树
# ""
# class Node:
#     """
#     # 节点类
#     """
#     def __init__(self, elem, lchild=None, rchild=None):
#         self.elem = elem
#         self.lchild = lchild
#         self.rchild = rchild
#
#
# class Tree:
#     """树类"""
#     def __init__(self, root=None):
#         self._root = root
#
#     def add(self, item):
#         node = Node(item)
#         if not self._root:
#             self._root = node
#             return
#         queue = [self._root]
#         while queue:
#             cur = queue.pop(0)
#             if not cur.lchild:
#                 cur.lchild = node
#                 return
#             elif not cur.rchild:
#                 cur.rchild = node
#                 return
#             else:
#                 queue.append(cur.rchild)
#                 queue.append(cur.lchild)